//关于管理的操作
//包括登录,注册,删除书籍,添加书籍,修改书籍,退出登录等

import request from "./request";

//管理员登录
export function adminLogin(adminObj) {
  return request.post('/admin/login',{
    username:adminObj.username,
    password:adminObj.password,
  })
}

//管理员注册
export function adminRegister(adminObj) {
  console.log(adminObj);
  return request.post('/admin/regist',{
    username:adminObj.username,
    password:adminObj.password,
    // passwordAgain:adminObj.password,
    nickname:adminObj.nickname,
    age: adminObj.age,
    sex: adminObj.sex,
    adminIcon: adminObj.adminIcon,
    realname: adminObj.realName,
    phone: adminObj.phone,
  })
}

//查看所有用户
export function adminAll() {
  return request.get('/admin/getAllUser');
}

//使用用户名查询用户
export function selectByUsername(username){
  return request.post('/admin/getUser',{
    username
  });
}

//上传接口
export function imageUpload(file){
  return request.post('/imageUpload',{
    file
  });
}

//根据用户名删除接口
export function delByUserName(username) {
  return request.post('/admin/delete',{
    username
  });
}

//根据用户名查询详情照片
export function getDetailByUserName(username){
  return request.get(`/admin/getImagesByUsername?username=${username}`);
}

